<%
layout("/layouts/platform.html"){
%>
<div class="panel-body" style="padding-top: 15px;">
	<div class="box">
		<div class="box-body">
			<div class="col-sm-12">
				<div class="row">
			        <table class="table table-bordered table-hover mg-t datatable">
			            <thead>
			            <tr>
							<th>支付微信</th>
							<th>商户号</th>
							<th>用户标示</th>
							<th>金额</th>
							<th>时间</th>
							<!-- <th>操作</th> -->
			        </table>
		        </div>
		    </div>
	    </div>
	</div>
</div>
<script language="JavaScript">
    var datatable;
    function initDatatable() {
        datatable = $('.datatable').DataTable({
            "dom": '<"toolbar">frtip',
            "searching": false,
            "processing": false,
            "serverSide": true,
            "select": true,
            "ordering": true,
            "language": {
                "url": "${base}/assets/plugins/datatables/cn.json"
            },
            "preDrawCallback": function () {
                sublime.showLoadingbar($(".main-content"));
            },
            "drawCallback": function () {
                sublime.closeLoadingbar($(".main-content"));
            },
            "ajax": {
                "url": "${base}/platform/statistics/wxtrans/data",
                "type": "post",
                "data": function (d) {
                	//d.name=$('#nameStr').val();
                }
            },
            "order": [[0, "desc"]],
            "columns": [
				{"data": "appid", "bSortable": true},
				{"data": "mch_id", "bSortable": true},
				{"data": "openid", "bSortable": true},
				{"data": "total_fee", "bSortable": true},
				{"data": "time_end", "bSortable": true}
            ],
            "columnDefs": [
               	{
                 	"render": function (data, type, row) {
                   		return getWxConfig(data);
             		 },
                  	"targets": 0
               	},
               	{
                 	"render": function (data, type, row) {
                   		return data/100+"元";
             		 },
                  	"targets": 3
               	},
               	{
               		"render": function (data, type, row) {
               			if (data!=null) {
                      		return data;//moment(data).format("YYYY-MM-DD HH:mm:ss");
                    	}
                      	return '';
                    },
                    "targets": 4
               	}
            ]
        });
       /*  datatable.on('click', 'tr', function () {
	    	$(this).addClass("s1").siblings().removeClass("s1");
	    	 $(this).find(":radio").attr("checked", true);
	    }); 
        $("#searchBtn").on('click', function () {
            datatable.ajax.reload();
        }); */
    }
    $(function () {
        initDatatable();
        $("#dialogDetail").on("hidden.bs.modal", function () {
            $(this).removeData("bs.modal");
        });
    });
    
    function getWxConfig(id){
    	var datas="";
    	$.ajax({
			url : "${base}/platform/statistics/wxtrans/getWxConfig",
			data : {
				id : id
			},
			type : "post",
			async : false,
			dataType : "json",
			success : function(data){
				datas= data;
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				return false;
			}
		});
    	return datas;
    }
</script>

<%}%>
